; jmc-lisp-eval-demo.cl

; Tested with GNU CLISP
; http://clisp.cons.org/

; http://www.paulgraham.com/rootsoflisp.html
; http://lib.store.yahoo.net/lib/paulgraham/jmc.lisp

(load "jmc.lisp")
(trace eval.)
; p9

(print (list
 (equal
  (eval. 'x '((x a) (y b))) ;expression to evaluate
  'a                        ;expected result
 )
 (equal
  (eval. '(eq 'a 'a) '())
  t
 )
 (equal
  (eval. '(cons x '(b c))
         '((x a) (y b)))
  '(a b c)
 )
 (equal
  (eval. '(f '(b c))
         '((f (lambda (x) (cons 'a x)))))
  '(a b c)
 )
 (equal
  (eval. '((label firstatom (lambda (x)
                              (cond ((atom x) x)
                                    ('t (firstatom (car x))))))
           y)
         '((y ((a b) (c d)))))
  'a
 )
 (equal
  (eval. '((lambda (x y) (cons x (cdr y)))
         'a
         '(b c d))
         '())
  '(a c d)
 )
))
